1. Field of the Invention
This invention generally relates to methods and systems for processing COBOL language record description entries that specify data items that include a varying length characteristic and computer readable storage medium for storing instructions for performing the method. In particular, one embodiment of the invention relates to VARCHAR/VARGRAPHIC/COBOL source language definition, compilation and processing support.
2. Background Art
Database languages such as DB2 have the facility to map an extract file by generating record description entries in PL/I and/or COBOL. However, fields that are defined with a varying length attribute cannot be described in the same manner in both PL/I and COBOL since COBOL does not support such an attribute.
In other words, database languages such as DB2 have allowed a varying length attribute for character and/or graphic fields. This allowed the storage space requirements for data to be reduced by storing only the actual amount of data used for a particular data item rather than always storing a fixed, maximum number of bytes that frequently contained many unused (blank) bytes. Previous solutions allowed for the extracting and/or unloading of data from databases into sequential files. Application program interfaces were also provided which allowed user written programs access to the data.
When extracted and/or unloaded varying length data items are placed into computer memory, they are frequently broken down into two (2) subfields. The first subfield contains length and is a two (2) byte binary half word that contains the number of SBCS/DBCS (i.e., Single Byte Character Set/Double Byte Character Set) characters actually used. Graphic data uses the DBCS for data content and each graphic character requires two (2) bytes of memory. For example, a field containing 9 graphic characters will have a length value of 9, even though it requires 18 bytes of memory. The second subfield contains the actual data. The amount of memory reserved is based on the specified maximum allowed number of characters regardless of the actual number of used bytes.
Some application programming languages such as PL/I have allowed for the definition of data items that include a varying length attribute. However, previous and current COBOL compilers make no provision for such an attribute. In COBOL, the above-mentioned two subfields must be defined as two separate and distinct data items. The first item defines the length as a two (2) byte binary half word. The second item defines a fixed length character and/or graphic field based on the specified maximum allowed number of characters. With COBOL, application programmers must maintain the relationship between the two independent fields by updating both fields themselves.
Data processing frequently involves retrieving stored data, processing the retrieved data, and storing or otherwise using the processed data. These functions may be embodied in a data processing application that is part of a larger data processing system. In many cases, the process is independent from the storage and retrieval system and a predefined syntax is used to communicate data between the two. Some storage and retrieval systems restrict how data is stored and retrieved. For example, a storage and retrieval system may group data into files, records, and fields, and typically access the data at the field level or higher. Similarly, the process itself may only accept and return field level data. Accordingly, the syntax for communicating the data to the process may also be limited to field level data. The lowest level data sets handled by a storage and retrieval system, process, or communication syntax may be referred to as a “data segment.” In the example above, the data segments are fields.
For additional understanding of the limitations in some data processing systems, a look at how digital data is stored may be instructive. Digital data is frequently stored in one or more data sources, such as a database or data warehouse. The data may be stored according to a variety of data structures corresponding to physical memory locations. The physical data structure may, in turn, correspond to one or more storage/access structures, such as a file structure or hierarchical or relational database structure.
For example, the data may be divided into files, which are divided into records, which are divided into fields. Fields may actually include a sequence of bits (1s and 0s). Depending on the data type of the field, the sequence of bits may be translated into another format, such as integers, floating point numbers, strings, logic values, or other formats. Fields may be viewed as being composed of one or more sub-segments based upon their data type.
For example, an integer or floating point number may include one or more decimal digits, a string may include one or more characters. These individual decimal digits or characters are the field's sub-segments. Sub-segments may correspond directly to a fixed number of bits, such as characters corresponding to bytes, packed decimal digits corresponding to four bit nibbles, or Boolean or binary data corresponding to a single bit.
Other data, such as some integers, may be stored in variable bit length sub-segments. Fields may also include one or more bits corresponding to other information, such as a sign or the location of a decimal point. In some cases, this additional information may be coded into a particular sub-segment in the field. Other data processing systems may handle data using data segments other than fields that are similarly composed of sub-segments.